package org.opens.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.ThreadPoolExecutor;

@RestController
@RequestMapping(value = "/thread-pool")
public class ThreadPoolController {

    @Autowired(required = false)
    private ThreadPoolExecutor threadPoolExecutor;

    @GetMapping(value = "/pool-size")
    public Integer getPoolSize() {
        return threadPoolExecutor.getCorePoolSize();
    }

}
